package cn.kgc.controller;

import cn.kgc.entity.Role;
import cn.kgc.service.RoleService;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Rock
 * @create 2020-03-04 21:39
 */
@Controller
@RequestMapping("/sys/role")
public class RoleController {
    @Autowired
    private RoleService service;

    @ResponseBody
    @RequestMapping(
            value = "/queryAll",
            method = RequestMethod.GET,
            produces = "application/json;charset=utf-8")
    public String queryAll(){
        List<Role> list = service.queryAll();
        return JSON.toJSONString(list);
    }
}
